package yxy.cherry.battle;

import yxy.cherry.battle.module.FighterData;
import yxy.cherry.battle.module.Position;
import yxy.cherry.battle.module.TriggerPoint;
import yxy.cherry.battle.module.affix.AffixFactory;
import yxy.cherry.battle.module.record.FighterPosition;
import yxy.cherry.battle.module.record.stream.RecordStream_ACT;

/**
 * 神兽类
 * @see Pokemon#Pokemon(Team team, int skillGroupId, int level, FighterData avgFighterData)
 **/
public class Pokemon extends Fighter {

    private static final String POKEMON_NAME = "神兽";
    private static final String TRIGGER_POINT = "初始";

    /**
     * @param team 所处阵营
     * @param skillGroupId 技能组id
     * @param level 技能等级
     * @param avgFighterData 队伍平均属性
     */
    public Pokemon(Team team, int skillGroupId, int level, FighterData avgFighterData){
        super.data = avgFighterData;
        super.position = Position.SS;
        setTeam(team);
        skills.addAll(AffixFactory.getInstance().createAffix(this, skillGroupId, level, 1));
    }

    @Override
    public String getName() {
        return POKEMON_NAME + data.getName();
    }

    @Override
    public void doAct() {
        getRecord().stream(new RecordStream_ACT(this)).record();
        getAffixContext().reset();
        getAffixContext().get攻击行动().set行动者(this);
        handlec初始二();
    }

    @Override
    public boolean canAct() {
        return true;
    }

    @Override
    public void setFighterPosition(boolean isLeft) {
        if (super.fighterPosition != null) {
            return;
        }
        Position position = super.getPosition();
        super.fighterPosition = FighterPosition.forPosition(position, isLeft);
    }

    @Override
    public String toString() {
        return POKEMON_NAME;
    }

    public void handlec初始二() {
        Battle.battleLogger(4,TRIGGER_POINT);
        trigger(TriggerPoint.初始二);
    }
}
